﻿using BLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MODEL;

namespace workAPP.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class UserController : ControllerBase
    {
        public UserController(UserBLL bll)
        {
            Bll = bll;
        }

        public UserBLL Bll { get; }


        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        [HttpPost("AddUser")]
        public int AddUser(User user)
        {
            try
            {
                return Bll.AddUser(user);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        [HttpGet("showUser")]
        public dynamic showUser(int index, int size)
        {
            try
            {
                return Bll.showUser(index, size);

            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet("GetUsers")]
        public List<User> GetUsers()
        {
            return Bll.GetUsers();
        }



    }
}
